<!doctype html>














<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="en" 
  
>
  <!-- The Head -->

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta
    name="viewport"
    content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
  >

  

  

  
    <!-- Begin Jekyll SEO tag v2.8.0 -->
<meta name="generator" content="Jekyll v4.3.2" />
<meta property="og:title" content="The Robot Operating System 2 (ROS2)" />
<meta name="author" content="Chunsheng Luo" />
<meta property="og:locale" content="en" />
<meta name="description" content="一、ROS2介绍" />
<meta property="og:description" content="一、ROS2介绍" />
<link rel="canonical" href="https://luochenglcs.github.io/posts/ROS2-For-Industrial-Control/" />
<meta property="og:url" content="https://luochenglcs.github.io/posts/ROS2-For-Industrial-Control/" />
<meta property="og:site_name" content="Cheng Luo" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2021-07-21T00:00:00+00:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="The Robot Operating System 2 (ROS2)" />
<meta name="twitter:site" content="@luochenglcs" />
<meta name="twitter:creator" content="@Chunsheng Luo" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"Chunsheng Luo","url":"https://github.com/luochenglcs"},"dateModified":"2023-08-07T07:23:58+00:00","datePublished":"2021-07-21T00:00:00+00:00","description":"一、ROS2介绍","headline":"The Robot Operating System 2 (ROS2)","mainEntityOfPage":{"@type":"WebPage","@id":"https://luochenglcs.github.io/posts/ROS2-For-Industrial-Control/"},"url":"https://luochenglcs.github.io/posts/ROS2-For-Industrial-Control/"}</script>
<!-- End Jekyll SEO tag -->

  

  <title>The Robot Operating System 2 (ROS2) | Cheng Luo
  </title>

  <!--
  The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
  Generated by: https://realfavicongenerator.net/
-->



<link rel="apple-touch-icon" sizes="180x180" href="/assets/img/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicons/favicon-16x16.png">
<link rel="manifest" href="/assets/img/favicons/site.webmanifest">
<link rel="shortcut icon" href="/assets/img/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Cheng Luo">
<meta name="application-name" content="Cheng Luo">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/assets/img/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">


  
    
      <link rel="preconnect" href="https://fonts.googleapis.com" >
      <link rel="dns-prefetch" href="https://fonts.googleapis.com" >
    
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
      <link rel="dns-prefetch" href="https://fonts.gstatic.com" crossorigin>
    
      <link rel="preconnect" href="https://fonts.googleapis.com" >
      <link rel="dns-prefetch" href="https://fonts.googleapis.com" >
    
      <link rel="preconnect" href="https://cdn.jsdelivr.net" >
      <link rel="dns-prefetch" href="https://cdn.jsdelivr.net" >
    

    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap">
  

  <!-- GA -->
  

  <!-- Bootstrap -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css">

  <link rel="stylesheet" href="/assets/css/style.css">

  
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tocbot@4.21.0/dist/tocbot.min.css">
  

  
    <!-- Manific Popup -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
  

  <!-- JavaScript -->

  
    <!-- Switch the mode between dark and light. -->

<script type="text/javascript">
  class ModeToggle {
    static get MODE_KEY() {
      return 'mode';
    }
    static get MODE_ATTR() {
      return 'data-mode';
    }
    static get DARK_MODE() {
      return 'dark';
    }
    static get LIGHT_MODE() {
      return 'light';
    }
    static get ID() {
      return 'mode-toggle';
    }

    constructor() {
      if (this.hasMode) {
        if (this.isDarkMode) {
          if (!this.isSysDarkPrefer) {
            this.setDark();
          }
        } else {
          if (this.isSysDarkPrefer) {
            this.setLight();
          }
        }
      }

      let self = this;

      /* always follow the system prefers */
      this.sysDarkPrefers.addEventListener('change', () => {
        if (self.hasMode) {
          if (self.isDarkMode) {
            if (!self.isSysDarkPrefer) {
              self.setDark();
            }
          } else {
            if (self.isSysDarkPrefer) {
              self.setLight();
            }
          }

          self.clearMode();
        }

        self.notify();
      });
    } /* constructor() */

    get sysDarkPrefers() {
      return window.matchMedia('(prefers-color-scheme: dark)');
    }

    get isSysDarkPrefer() {
      return this.sysDarkPrefers.matches;
    }

    get isDarkMode() {
      return this.mode === ModeToggle.DARK_MODE;
    }

    get isLightMode() {
      return this.mode === ModeToggle.LIGHT_MODE;
    }

    get hasMode() {
      return this.mode != null;
    }

    get mode() {
      return sessionStorage.getItem(ModeToggle.MODE_KEY);
    }

    /* get the current mode on screen */
    get modeStatus() {
      if (this.isDarkMode || (!this.hasMode && this.isSysDarkPrefer)) {
        return ModeToggle.DARK_MODE;
      } else {
        return ModeToggle.LIGHT_MODE;
      }
    }

    setDark() {
      document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
      sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
    }

    setLight() {
      document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
      sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
    }

    clearMode() {
      document.documentElement.removeAttribute(ModeToggle.MODE_ATTR);
      sessionStorage.removeItem(ModeToggle.MODE_KEY);
    }

    /* Notify another plugins that the theme mode has changed */
    notify() {
      window.postMessage(
        {
          direction: ModeToggle.ID,
          message: this.modeStatus
        },
        '*'
      );
    }

    flipMode() {
      if (this.hasMode) {
        if (this.isSysDarkPrefer) {
          if (this.isLightMode) {
            this.clearMode();
          } else {
            this.setLight();
          }
        } else {
          if (this.isDarkMode) {
            this.clearMode();
          } else {
            this.setDark();
          }
        }
      } else {
        if (this.isSysDarkPrefer) {
          this.setLight();
        } else {
          this.setDark();
        }
      }

      this.notify();
    } /* flipMode() */
  } /* ModeToggle */

  const modeToggle = new ModeToggle();
</script>

  

  <!-- A placeholder to allow defining custom metadata -->

</head>


  <body>
    <!-- The Side Bar -->

<div id="sidebar" class="d-flex flex-column align-items-end">
  <div class="profile-wrapper">
    <a href="/" id="avatar" class="rounded-circle">
      
        
        <img src="/assets/img/favicons/android-chrome-512x512.png" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
      
    </a>

    <div class="site-title">
      <a href="/">Cheng Luo</a>
    </div>
    <div class="site-subtitle fst-italic">Linux operating system engineer</div>
  </div>
  <!-- .profile-wrapper -->

  <ul class="nav flex-column flex-grow-1 w-100 ps-0">
    <!-- home -->
    <li class="nav-item">
      <a href="/" class="nav-link">
        <i class="fa-fw fas fa-home"></i>
        <span>HOME</span>
      </a>
    </li>
    <!-- the real tabs -->
    
      <li class="nav-item">
        <a href="/categories/" class="nav-link">
          <i class="fa-fw fas fa-stream"></i>
          

          <span>CATEGORIES</span>
        </a>
      </li>
      <!-- .nav-item -->
    
      <li class="nav-item">
        <a href="/tags/" class="nav-link">
          <i class="fa-fw fas fa-tags"></i>
          

          <span>TAGS</span>
        </a>
      </li>
      <!-- .nav-item -->
    
      <li class="nav-item">
        <a href="/archives/" class="nav-link">
          <i class="fa-fw fas fa-archive"></i>
          

          <span>ARCHIVES</span>
        </a>
      </li>
      <!-- .nav-item -->
    
      <li class="nav-item">
        <a href="/about/" class="nav-link">
          <i class="fa-fw fas fa-info-circle"></i>
          

          <span>ABOUT</span>
        </a>
      </li>
      <!-- .nav-item -->
    
  </ul>
  <!-- ul.nav.flex-column -->

  <div class="sidebar-bottom d-flex flex-wrap  align-items-center w-100">
    
      <button class="mode-toggle btn" aria-label="Switch Mode">
        <i class="fas fa-adjust"></i>
      </button>

      
        <span class="icon-border"></span>
      
    

    
      

      
        <a
          href="https://github.com/luochenglcs"
          aria-label="github"
          

          
            target="_blank"
            
          

          

          
            rel="noopener noreferrer"
          
        >
          <i class="fab fa-github"></i>
        </a>
      
    
      

      
    
      

      
        <a
          href="javascript:location.href = 'mailto:' + ['luochunsheng','ustc.edu'].join('@')"
          aria-label="email"
          

          

          

          
        >
          <i class="fas fa-envelope"></i>
        </a>
      
    
  </div>
  <!-- .sidebar-bottom -->
</div>
<!-- #sidebar -->


    <div id="main-wrapper" class="d-flex justify-content-center">
      <div id="main" class="container px-xxl-5">
        <!-- The Top Bar -->

<div id="topbar-wrapper">
  <div
    id="topbar"
    class="container d-flex align-items-center justify-content-between h-100"
  >
    <span id="breadcrumb">
      

      
        
          
            <span>
              <a href="/">
                Home
              </a>
            </span>

          
        
          
        
          
            
              <span>The Robot Operating System 2 (ROS2)</span>
            

          
        
      
    </span>
    <!-- endof #breadcrumb -->

    <i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>

    <div id="topbar-title">
      Post
    </div>

    <i id="search-trigger" class="fas fa-search fa-fw"></i>
    <span id="search-wrapper" class="align-items-center">
      <i class="fas fa-search fa-fw"></i>
      <input
        class="form-control"
        id="search-input"
        type="search"
        aria-label="search"
        autocomplete="off"
        placeholder="Search..."
      >
    </span>
    <span id="search-cancel">Cancel</span>
  </div>
</div>

        











<div class="row">
  <!-- core -->
  <div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pe-xl-4">
    

    <div class="post px-1 px-md-2">
      

      
        
      
        <!-- Refactor the HTML structure -->



<!--
  In order to allow a wide table to scroll horizontally,
  we suround the markdown table with `<div class="table-wrapper">` and `</div>`
-->



<!--
  Fixed kramdown code highlight rendering:
  https://github.com/penibelst/jekyll-compress-html/issues/101
  https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
-->



<!-- Change the icon of checkbox -->


<!-- images -->



  
  

  <!-- CDN URL -->
  

  <!-- Add image path -->
  

  
    
      
      
    

    
    

    

    
    

    
    
    
    

    
      

      
      
      

      
    
      

      
      
      

      
    

    <!-- take out classes -->
    

    

    

    

    <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
    
    

    <!-- add image placeholder -->
    
      
    

    <!-- Bypass the HTML-proofer test -->
    

    
      <!-- make sure the `<img>` is wrapped by `<a>` -->
      

      
        <!-- create the image wrapper -->
        
      
    

    <!-- combine -->
    

  
    

    
    

    

    
    

    
    
    
    

    
      

      
      
      

      
    
      

      
      
      

      
    

    <!-- take out classes -->
    

    

    

    

    <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
    
    

    <!-- add image placeholder -->
    
      
    

    <!-- Bypass the HTML-proofer test -->
    

    
      <!-- make sure the `<img>` is wrapped by `<a>` -->
      

      
        <!-- create the image wrapper -->
        
      
    

    <!-- combine -->
    

  
    

    
    

    

    
    

    
    
    
    

    
      

      
      
      

      
    
      

      
      
      

      
    

    <!-- take out classes -->
    

    

    

    

    <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
    
    

    <!-- add image placeholder -->
    
      
    

    <!-- Bypass the HTML-proofer test -->
    

    
      <!-- make sure the `<img>` is wrapped by `<a>` -->
      

      
        <!-- create the image wrapper -->
        
      
    

    <!-- combine -->
    

  
    

    
    

    

    
    

    
    
    
    

    
      

      
      
      

      
    
      

      
      
      

      
    

    <!-- take out classes -->
    

    

    

    

    <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
    
    

    <!-- add image placeholder -->
    
      
    

    <!-- Bypass the HTML-proofer test -->
    

    
      <!-- make sure the `<img>` is wrapped by `<a>` -->
      

      
        <!-- create the image wrapper -->
        
      
    

    <!-- combine -->
    

  
    

    
    

    

    
    

    
    
    
    

    
      

      
      
      

      
    
      

      
      
      

      
    

    <!-- take out classes -->
    

    

    

    

    <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
    
    

    <!-- add image placeholder -->
    
      
    

    <!-- Bypass the HTML-proofer test -->
    

    
      <!-- make sure the `<img>` is wrapped by `<a>` -->
      

      
        <!-- create the image wrapper -->
        
      
    

    <!-- combine -->
    

  

  



<!-- Add header for code snippets -->



<!-- Create heading anchors -->





  
  

  

  
  

  
    
    

    
      
        
        
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    

    

  

  
  

  
    
    

    
      
        
        
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    
      

      
      

      
      
      

      

    

    

  

  
  

  




<!-- return -->




<h1 data-toc-skip>The Robot Operating System 2 (ROS2)</h1>

<div class="post-meta text-muted">
    <!-- published date -->
    <span>
      Posted
      <!--
  Date format snippet
  See: ${JS_ROOT}/utils/locale-dateime.js
-->





<em
  class=""
  data-ts="1626825600"
  data-df="ll"
  
    data-bs-toggle="tooltip" data-bs-placement="bottom"
  
>
  Jul 21, 2021
</em>

    </span>

    <!-- lastmod date -->
    
    <span>
      Updated
      <!--
  Date format snippet
  See: ${JS_ROOT}/utils/locale-dateime.js
-->





<em
  class=""
  data-ts="1691393038"
  data-df="ll"
  
    data-bs-toggle="tooltip" data-bs-placement="bottom"
  
>
  Aug  7, 2023
</em>

    </span>
    

  

  <div class="d-flex justify-content-between">
    <!-- author(s) -->
    <span>
      

      By

      <em>
      
        
          <a href="https://github.com/luochenglcs">Chunsheng Luo</a>
          
        
      
      </em>
    </span>

    <div>
      <!-- read time -->
      <!-- Calculate the post's reading time, and display the word count in tooltip -->



<!-- words per minute -->










<!-- return element -->
<span
  class="readtime"
  data-bs-toggle="tooltip"
  data-bs-placement="bottom"
  title="3603 words"
>
  <em>20 min</em> read</span>

    </div>

  </div> <!-- .d-flex -->

</div> <!-- .post-meta -->
<div class="post-content">
  <h3 id="一ros2介绍"><span class="me-2">一、ROS2介绍</span><a href="#一ros2介绍" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//www.jianshu.com/p/3829624ac310 //ROS2简介 有图有介绍，很详细</span>
</pre></td></tr></tbody></table></code></div></div>

<p><a href="/posts/.\images\ROS2-For-Industrial-Control\ROS1 Vs ROS2.png" class="popup img-link "><img data-src="/posts/.\images\ROS2-For-Industrial-Control\ROS1 Vs ROS2.png" alt="image-20210628143103792" class="lazyload" data-proofer-ignore></a></p>

<p><a href="/posts/.\images\ROS2-For-Industrial-Control\ROS通信机制.png" class="popup img-link "><img data-src="/posts/.\images\ROS2-For-Industrial-Control\ROS通信机制.png" alt="image-20210628142816662" class="lazyload" data-proofer-ignore></a></p>

<h4 id="1-基本概念ros1-vs-ros2png"><span class="me-2">1) 基本概念ROS1 Vs ROS2.png</span><a href="#1-基本概念ros1-vs-ros2png" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h4>

<div class="language-xml highlighter-rouge"><div class="code-header">
        <span data-label-text="XML"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="rouge-code"><pre>Nodes-节点概念
节点即Node，是ROS里面的一个执行体，可以和其他节点直接在ROS中互相通信。Node是Package里面的可执行文件
的一个功能体现（也就是说Package的可执行文件能够实现的功能不仅仅是一个Node，还有其他的功能，但是Node
是其最基本的一个功能）。

节点通过发布messages到topic来实现互相通信。也可以调用ROS的service实现request和response的消息交换。
</pre></td></tr></tbody></table></code></div></div>

<div class="language-xml highlighter-rouge"><div class="code-header">
        <span data-label-text="XML"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
</pre></td><td class="rouge-code"><pre>Messages-消息概念
message 是一种由类型字段（类型域）组成的简单数据结构。支持原始的标准类型（整数、浮点、布尔、数组
等），同时支持类似C语言的结构和数组嵌套。

我们使用.msg格式的的文本文件指定消息的数据结构。
</pre></td></tr></tbody></table></code></div></div>

<div class="language-xml highlighter-rouge"><div class="code-header">
        <span data-label-text="XML"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
</pre></td><td class="rouge-code"><pre>Topic-话题概念
Topic 被称为节点信息交互的总线，话题拥有匿名发布和订阅语义，这样能够解耦信息的生产者和使用者。通常来
说，节点是不清楚他们在和谁通信，他们更关注所订阅话题的数据。

一个话题可以有多个订阅者和发布者。
</pre></td></tr></tbody></table></code></div></div>

<div class="language-xml highlighter-rouge"><div class="code-header">
        <span data-label-text="XML"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="rouge-code"><pre>Discovery-发现
节点之间的互相发现是ROS2底层的中间件自动运行的一个进程，通过这个进程不同的节点相互发现，建立连接。这
是区别ROS1中的master，真正实现了分布式通信。

当一个节点启动后， 它会向其他拥有相同ROS域名(ROS domain， 可以通过设置ROS_DOMAIN_ID环境变量来设置)
的节点进行广播，说明它已经上线。
其他节点在收到广播后返回自己的相关信息，这样节点间的连接就可以建立了，之后就可以通信了。

节点会定时广播它的信息，这样即使它已经错过了最初的发现过程，它也可以和新上线的节点进行连接。
节点在下线前它也会广播其他节点自己要下线了。
节点只会和具有相兼容的[服务质量]设置的节点进行通信。
</pre></td></tr></tbody></table></code></div></div>

<h4 id="2-qos"><span class="me-2">2) Qos</span><a href="#2-qos" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h4>

<h4 id="3real-time-publishsubscribe-protocol"><span class="me-2">3)Real-Time Publish/Subscribe Protocol</span><a href="#3real-time-publishsubscribe-protocol" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h4>

<p>实时发布订阅协议（Real Time Publish Subscribe Protocol，RTPS）是一种协议，用于在单播和多播中通过
UDP等不可靠传输进行best effort和reliable的发布-订阅通信.</p>

<pre><code class="language-C">RTPS协议的主要特点是：

性能和服务质量（QoS）属性，为使用标准IP网络的实时应用程序提供best-effort和reliable的发布-订阅通信。
容错，可以创建没有单点故障的网络。
可扩展性，可以通过协议的扩展和新服务的增强实现向后兼容性和互操作性。
即插即用连接，新的应用程序和服务允许通过应用程序随时加入和离开网络来实现自动的、无需配置的发现。
可配置性，可以平衡每个数据交付事务的可靠性和及时性需求。
模块化，允许简单的设备实现协议的子集，并且仍然参与发布-订阅网络。
可伸缩性，使系统能够扩展到非常大的发布-订阅网络。
类型安全，防止应用程序编程错误影响发布-订阅网络中的远程节点的操作。
</code></pre>

<p>OMG规范： 定义了基于RTPS的DDS设计</p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//www.omg.org/spec/DDSI-RTPS/2.2/PDF</span>
<span class="n">https</span><span class="o">:</span><span class="c1">//blog.csdn.net/DDS_CSIT/article/details/104940013 spec的中文文档</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//paul.pub/dds-and-fastrtps/</span>
<span class="err">在</span><span class="n">DDS</span><span class="err">规范中，有两个描述标准的基本文档：</span>
<span class="n">DDS</span> <span class="n">Specification</span><span class="err">：描述了以数据为中心的发布</span><span class="o">-</span><span class="err">订阅模型。该规范定义了</span><span class="n">API</span><span class="err">和通信语义（行为和服务质量），</span>
<span class="err">使消息从消息生产者有效地传递到匹配的消费者。</span><span class="n">DDS</span><span class="err">规范的目的可以概括为：“能够在正确的时间将正确的信息高</span>
<span class="err">效，可靠地传递到正确的位置”。</span>
<span class="n">DDSI</span><span class="o">-</span><span class="n">RTPS</span><span class="err">：描述了</span><span class="n">RTPS</span><span class="err">（</span><span class="n">Real</span> <span class="n">Time</span> <span class="n">Publish</span> <span class="n">Subscribe</span> <span class="n">Protocol</span><span class="err">）协议。该协议通过</span><span class="n">UDP</span><span class="err">等不可靠的传输</span>
<span class="err">，实现最大努力（</span><span class="n">Best</span><span class="o">-</span><span class="n">Effort</span><span class="err">）和可靠的发布</span><span class="o">-</span><span class="err">订阅通信。</span><span class="n">RTPS</span><span class="err">是</span><span class="n">DDS</span><span class="err">实现的标准协议，它的目的和范围是确保基</span>
<span class="err">于不同</span><span class="n">DDS</span><span class="err">供应商的应用程序可以实现互操作。</span>
    
<span class="err">传输控制</span>
<span class="n">Fast</span><span class="o">-</span><span class="n">RTPS</span><span class="err">实现了可插拔的传输架构，这意味着每一个参与者可以随时加入和退出。</span>
<span class="err">在传输上，</span><span class="n">Fast</span><span class="o">-</span><span class="n">RTPS</span><span class="err">支持以下五种传输方式：</span>
<span class="n">UDPv4</span> <span class="n">UDPv6</span> <span class="n">TCPv4</span> <span class="n">TCPv6</span> <span class="n">SHM</span><span class="err">（</span><span class="n">Shared</span> <span class="n">Memory</span><span class="err">）</span>
<span class="err">默认的，当</span><span class="n">Participant</span><span class="err">创建时，会自动的配置两个传输通道：</span>
<span class="n">SHM</span><span class="err">：用来与同一个机器上的参与者通信。</span>
<span class="n">UDPv4</span><span class="err">：同来与跨机器的参与者通信。</span>
<span class="err">当然，开发者可以改变这个默认行为，通过</span><span class="n">C</span><span class="o">++</span><span class="err">接口或者</span><span class="n">XML</span><span class="err">配置文件都可以。</span>
<span class="n">SHM</span><span class="err">要求所有参与者位于同一个系统上，它是借助了操作系统提供的共享内存机制实现。共享内存的好处是：支持大</span>
<span class="err">数据传输，减少了数据拷贝，并且也减少系统负载。因此通常情况下，使用</span><span class="n">SHM</span><span class="err">会获得更好的性能。使用</span><span class="n">SHM</span><span class="err">时，可</span>
<span class="err">以配置共享内存的大小。</span>
</pre></td></tr></tbody></table></code></div></div>

<p><a href="/posts/.\images\ROS2-For-Industrial-Control\RTPS-USE-unreliable-proctocol.png" class="popup img-link "><img data-src="/posts/.\images\ROS2-For-Industrial-Control\RTPS-USE-unreliable-proctocol.png" alt="image-20210628151633210" class="lazyload" data-proofer-ignore></a></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
</pre></td><td class="rouge-code"><pre><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="n">The</span> <span class="n">DDSI</span><span class="o">-</span><span class="n">RTPS</span> <span class="p">(</span><span class="n">DDS</span><span class="o">-</span><span class="n">Interoperability</span> <span class="n">Real</span> <span class="n">Time</span> <span class="n">Publish</span> <span class="n">Subscribe</span><span class="p">)</span> <span class="n">protocol</span> 
    
<span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="n">eProsima</span><span class="err">’</span><span class="n">s</span> <span class="n">FastRTPS</span> <span class="n">implementation</span> <span class="n">is</span> <span class="n">available</span> <span class="n">on</span> <span class="n">GitHub</span> <span class="n">and</span> <span class="n">is</span> <span class="n">LGPL</span> <span class="n">licensed</span><span class="o">:</span><span class="n">https</span><span class="o">:</span><span class="c1">//github.com/eProsima/Fast-RTPS</span>
<span class="n">eProsima</span> <span class="n">Fast</span> <span class="n">RTPS</span> <span class="n">is</span> <span class="n">a</span> <span class="n">relatively</span> <span class="n">new</span><span class="p">,</span> <span class="n">lightweight</span><span class="p">,</span> <span class="n">and</span> <span class="n">open</span> <span class="n">source</span> <span class="n">implementation</span> <span class="n">of</span> <span class="n">RTPS</span><span class="p">.</span>
 <span class="n">It</span> <span class="n">allows</span> <span class="n">direct</span> <span class="n">access</span> <span class="n">to</span> <span class="n">the</span> <span class="n">RTPS</span> <span class="n">protocol</span> <span class="n">settings</span> <span class="n">and</span> <span class="n">features</span><span class="p">,</span> <span class="n">which</span> <span class="n">is</span> <span class="n">not</span> <span class="n">always</span> 
 <span class="n">possible</span> <span class="n">with</span> <span class="n">other</span> <span class="n">DDS</span> <span class="n">implementations</span><span class="p">.</span> <span class="n">eProsima</span><span class="err">’</span><span class="n">s</span> <span class="n">implementation</span> <span class="n">also</span> <span class="n">includes</span> <span class="n">a</span> <span class="n">minimum</span> 
 <span class="n">DDS</span> <span class="n">API</span><span class="p">,</span> <span class="n">IDL</span> <span class="n">support</span><span class="p">,</span> <span class="n">and</span> <span class="n">automatic</span> <span class="n">code</span> <span class="n">generation</span> <span class="n">and</span> <span class="n">they</span> <span class="n">are</span> <span class="n">open</span> <span class="n">to</span> <span class="n">working</span> <span class="n">with</span> <span class="n">the</span> 
 <span class="n">ROS</span> <span class="n">community</span> <span class="n">to</span> <span class="n">meet</span> <span class="n">their</span> <span class="n">needs</span><span class="p">.</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//fast-dds.docs.eprosima.com/en/latest/ 介绍fast-dds with fast-RTPS</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//www.brixbot.com/ros2/fast_rtps-02-introduce_fast_buffer/ </span>
<span class="n">https</span><span class="o">:</span><span class="c1">//zhuanlan.zhihu.com/p/59465983</span>
<span class="n">ROS</span> <span class="mi">2</span><span class="err">使用</span><span class="n">Fast</span> <span class="n">RTPS</span><span class="err">去实现消息的订阅和发布。而</span><span class="n">Fast</span> <span class="n">RTPS</span><span class="err">要通过网络发送消息，就一定要把消息序列化成</span>
<span class="n">byte</span> <span class="n">array</span><span class="err">发送出去，然后消息订阅方收到消息后要把</span><span class="n">byte</span> <span class="n">array</span><span class="err">还原成对应的消息对象。消息的序列化和消息对</span>
<span class="err">象的还原就是</span><span class="n">Fast</span> <span class="n">Buffers</span><span class="err">干的活。</span>
<span class="err">按官网介绍，特点就是快。</span><span class="n">eProsima</span><span class="err">有对比</span><span class="n">Apache</span> <span class="n">Thrift</span><span class="err">和</span><span class="n">Google</span> <span class="n">Protocol</span> <span class="n">Buffers</span><span class="err">，其结果当然是自家的</span>
<span class="n">Fast</span> <span class="n">Buffers</span><span class="err">完胜。</span>
</pre></td></tr></tbody></table></code></div></div>

<p><a href="/posts/.\images\ROS2-For-Industrial-Control\fast-RTPS baseon fast buffer.png" class="popup img-link "><img data-src="/posts/.\images\ROS2-For-Industrial-Control\fast-RTPS baseon fast buffer.png" alt="image-20210628172218396" class="lazyload" data-proofer-ignore></a></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
</pre></td><td class="rouge-code"><pre><span class="nl">http:</span><span class="c1">//design.ros2.org/articles/ros_on_dds.html</span>

<span class="n">Publish</span><span class="o">-</span><span class="n">Subscribe</span> <span class="n">Transport</span>
<span class="n">The</span> <span class="n">DDSI</span><span class="o">-</span><span class="n">RTPS</span> <span class="p">(</span><span class="n">DDS</span><span class="o">-</span><span class="n">Interoperability</span> <span class="n">Real</span> <span class="n">Time</span> <span class="n">Publish</span> <span class="n">Subscribe</span><span class="p">)</span> <span class="n">protocol</span> <span class="n">would</span> <span class="n">replace</span> <span class="n">ROS</span><span class="err">’</span><span class="n">s</span> <span class="n">TCPROS</span> <span class="n">and</span> <span class="n">UDPROS</span> <span class="n">wire</span> <span class="n">protocols</span> <span class="k">for</span> <span class="n">publish</span><span class="o">/</span><span class="n">subscribe</span><span class="p">.</span> <span class="n">The</span> <span class="n">DDS</span> <span class="n">API</span> <span class="n">provides</span> <span class="n">a</span> <span class="n">few</span> <span class="n">more</span> <span class="n">actors</span> <span class="n">to</span> <span class="n">the</span> <span class="n">typical</span> <span class="n">publish</span><span class="o">-</span><span class="n">subscribe</span> <span class="n">pattern</span> <span class="n">of</span> <span class="n">ROS</span> <span class="mi">1</span><span class="p">.</span> <span class="n">In</span> <span class="n">ROS</span> <span class="n">the</span> <span class="n">concept</span> <span class="n">of</span> <span class="n">a</span> <span class="n">node</span> <span class="n">is</span> <span class="n">most</span> <span class="n">clearly</span> <span class="n">paralleled</span> <span class="n">to</span> <span class="n">a</span> <span class="n">graph</span> <span class="n">participant</span> <span class="n">in</span> <span class="n">DDS</span><span class="p">.</span> <span class="n">A</span> <span class="n">graph</span> <span class="n">participant</span> <span class="n">can</span> <span class="n">have</span> <span class="n">zero</span> <span class="n">to</span> <span class="n">many</span> <span class="n">topics</span><span class="p">,</span> <span class="n">which</span> <span class="n">are</span> <span class="n">very</span> <span class="n">similar</span> <span class="n">to</span> <span class="n">the</span> <span class="n">concept</span> <span class="n">of</span> <span class="n">topics</span> <span class="n">in</span> <span class="n">ROS</span><span class="p">,</span> <span class="n">but</span> <span class="n">are</span> <span class="n">represented</span> <span class="n">as</span> <span class="n">separate</span> <span class="n">code</span> <span class="n">objects</span> <span class="n">in</span> <span class="n">DDS</span><span class="p">,</span> <span class="n">and</span> <span class="n">is</span> <span class="n">neither</span> <span class="n">a</span> <span class="n">subscriber</span> <span class="n">nor</span> <span class="n">a</span> <span class="n">publisher</span><span class="p">.</span> <span class="n">Then</span><span class="p">,</span> <span class="n">from</span> <span class="n">a</span> <span class="n">DDS</span> <span class="n">topic</span><span class="p">,</span> <span class="n">DDS</span> <span class="n">subscribers</span> <span class="n">and</span> <span class="n">publishers</span> <span class="n">can</span> <span class="n">be</span> <span class="n">created</span><span class="p">,</span> <span class="n">but</span> <span class="n">again</span> <span class="n">these</span> <span class="n">are</span> <span class="n">used</span> <span class="n">to</span> <span class="n">represent</span> <span class="n">the</span> <span class="n">subscriber</span> <span class="n">and</span> <span class="n">publisher</span> <span class="n">concepts</span> <span class="n">in</span> <span class="n">DDS</span><span class="p">,</span> <span class="n">and</span> <span class="n">not</span> <span class="n">to</span> <span class="n">directly</span> <span class="n">read</span> <span class="n">data</span> <span class="n">from</span> <span class="n">or</span> <span class="n">write</span> <span class="n">data</span> <span class="n">to</span> <span class="n">the</span> <span class="n">topic</span><span class="p">.</span> <span class="n">DDS</span> <span class="n">has</span><span class="p">,</span> <span class="n">in</span> <span class="n">addition</span> <span class="n">to</span> <span class="n">the</span> <span class="n">topics</span><span class="p">,</span> <span class="n">subscribers</span><span class="p">,</span> <span class="n">and</span> <span class="n">publishers</span><span class="p">,</span> <span class="n">the</span> <span class="n">concept</span> <span class="n">of</span> <span class="n">DataReaders</span> <span class="n">and</span> <span class="n">DataWriters</span> <span class="n">which</span> <span class="n">are</span> <span class="n">created</span> <span class="n">with</span> <span class="n">a</span> <span class="n">subscriber</span> <span class="n">or</span> <span class="n">publisher</span> <span class="n">and</span> <span class="n">then</span> <span class="n">specialized</span> <span class="n">to</span> <span class="n">a</span> <span class="n">particular</span> <span class="n">message</span> <span class="n">type</span> <span class="n">before</span> <span class="n">being</span> <span class="n">used</span> <span class="n">to</span> <span class="n">read</span> <span class="n">and</span> <span class="n">write</span> <span class="n">data</span> <span class="k">for</span> <span class="n">a</span> <span class="n">topic</span><span class="p">.</span> <span class="n">These</span> <span class="n">additional</span> <span class="n">layers</span> <span class="n">of</span> <span class="n">abstraction</span> <span class="n">allow</span> <span class="n">DDS</span> <span class="n">to</span> <span class="n">have</span> <span class="n">a</span> <span class="n">high</span> <span class="n">level</span> <span class="n">of</span> <span class="n">configuration</span><span class="p">,</span> <span class="n">because</span> <span class="n">you</span> <span class="n">can</span> <span class="n">set</span> <span class="n">QoS</span> <span class="n">settings</span> <span class="n">at</span> <span class="n">each</span> <span class="n">level</span> <span class="n">of</span> <span class="n">the</span> <span class="n">publish</span><span class="o">-</span><span class="n">subscribe</span> <span class="n">stack</span><span class="p">,</span> <span class="n">providing</span> <span class="n">the</span> <span class="n">highest</span> <span class="n">granularity</span> <span class="n">of</span> <span class="n">configuration</span> <span class="n">possible</span><span class="p">.</span> <span class="n">Most</span> <span class="n">of</span> <span class="n">these</span> <span class="n">levels</span> <span class="n">of</span> <span class="n">abstractions</span> <span class="n">are</span> <span class="n">not</span> <span class="n">necessary</span> <span class="n">to</span> <span class="n">meet</span> <span class="n">the</span> <span class="n">current</span> <span class="n">needs</span> <span class="n">of</span> <span class="n">ROS</span><span class="p">.</span> <span class="n">Therefore</span><span class="p">,</span> <span class="n">packaging</span> <span class="n">common</span> <span class="n">workflows</span> <span class="n">under</span> <span class="n">the</span> <span class="n">simpler</span> <span class="n">ROS</span><span class="o">-</span><span class="n">like</span> <span class="n">interface</span> <span class="p">(</span><span class="n">Node</span><span class="p">,</span> <span class="n">Publisher</span><span class="p">,</span> <span class="n">and</span> <span class="n">Subscriber</span><span class="p">)</span> <span class="n">will</span> <span class="n">be</span> <span class="n">one</span> <span class="n">way</span> <span class="n">ROS</span> <span class="mi">2</span> <span class="n">can</span> <span class="n">hide</span> <span class="n">the</span> <span class="n">complexity</span> <span class="n">of</span> <span class="n">DDS</span><span class="p">,</span> <span class="k">while</span> <span class="n">exposing</span> <span class="n">some</span> <span class="n">of</span> <span class="n">its</span> <span class="n">features</span><span class="p">.</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//docs.ros.org/en/foxy/Concepts.html#internal-ros-interfaces //ROS2 官网概念介绍</span>
<span class="n">https</span><span class="o">:</span><span class="c1">//docs.ros.org/en/foxy/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html // ROS2官网简单pub-sub用例</span>
</pre></td></tr></tbody></table></code></div></div>

<h3 id="二dds介绍"><span class="me-2">二、DDS介绍</span><a href="#二dds介绍" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3>

<pre><code class="language-C">https://docs.ros.org/en/foxy/Tutorials/Discovery-Server/Discovery-Server.html?highlight=disc
</code></pre>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="nl">http:</span><span class="c1">//design.ros2.org/articles/ros_on_dds.html</span>
</pre></td></tr></tbody></table></code></div></div>

<p><a href="/posts/.\images\ROS2-For-Industrial-Control\DDS in ROS2.png" class="popup img-link "><img data-src="/posts/.\images\ROS2-For-Industrial-Control\DDS in ROS2.png" alt="image-20210628143617141" class="lazyload" data-proofer-ignore></a></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="rouge-code"><pre><span class="err">数据分发服务</span><span class="n">DDS</span><span class="p">(</span><span class="n">DataDistributionService</span><span class="p">)</span><span class="err">是对象管理组织</span><span class="p">(</span><span class="n">OMG</span><span class="p">)</span><span class="err">在</span><span class="n">HLA</span><span class="err">及</span><span class="n">CORBA</span><span class="err">等标准的基础上制定的新一代分布式实</span>
<span class="err">时通信中间件技术规范，</span><span class="n">DDS</span><span class="err">采用发布</span><span class="o">/</span><span class="err">订阅体系架构，强调以数据为中心，提供丰富的</span><span class="n">QoS</span><span class="err">服务质量策略，能保障数据进行实</span>
<span class="err">时、高效、灵活地分发，可满足各种分布式实时通信应用需求。</span><span class="n">DDS</span><span class="err">信息分发中间件是一种轻便的、能够提供实时信息传送的</span>
<span class="err">中间件技术。</span>
	
<span class="err">原文链接：</span><span class="n">https</span><span class="o">:</span><span class="c1">//blog.csdn.net/DDS_CSIT/article/details/104607476</span>
</pre></td></tr></tbody></table></code></div></div>

<h3 id="三使用"><span class="me-2">三、使用</span><a href="#三使用" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3>
<h4 id="1-编译"><span class="me-2">1&gt; 编译</span><a href="#1-编译" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h4>

<p>1、编译过程：</p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
</pre></td><td class="rouge-code"><pre><span class="n">cd</span> <span class="n">HERA</span>
<span class="n">colcon</span> <span class="n">build</span> <span class="o">--</span><span class="n">install</span><span class="o">-</span><span class="n">base</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">hera</span> <span class="o">--</span><span class="n">merge</span><span class="o">-</span><span class="n">install</span>
</pre></td></tr></tbody></table></code></div></div>

<p>2、依赖包</p>

<p>综合：</p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">libacl</span><span class="o">-</span><span class="n">devel</span> <span class="n">python3</span><span class="o">-</span><span class="n">importlib</span><span class="o">-</span><span class="n">resources</span> <span class="n">libatomic</span> <span class="n">tinyxml2</span> <span class="n">tinyxml2</span><span class="o">-</span><span class="n">devel</span> <span class="n">python3</span><span class="o">-</span><span class="n">lark</span><span class="o">-</span><span class="n">parser</span> <span class="n">log4cxx</span> <span class="n">log4cxx</span><span class="o">-</span><span class="n">devel</span> <span class="n">python3</span><span class="o">-</span><span class="n">numpy</span> 	
<span class="n">yum</span> <span class="n">install</span> <span class="n">boost</span>
<span class="c1">//https://pkgs.dyn.su/el8/extras/x86_64/asio-devel-1.14.0-12.el8.x86_64.rpm</span>
<span class="n">yum</span> <span class="n">localinstall</span> <span class="n">asio</span><span class="o">-</span><span class="n">devel</span><span class="o">-</span><span class="mi">1</span><span class="p">.</span><span class="mi">14</span><span class="p">.</span><span class="mi">0</span><span class="o">-</span><span class="mi">12</span><span class="p">.</span><span class="n">el8</span><span class="p">.</span><span class="n">x86_64</span><span class="p">.</span><span class="n">rpm</span>
</pre></td></tr></tbody></table></code></div></div>

<p>repo:</p>

<p>环境信息：</p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
</pre></td><td class="rouge-code"><pre><span class="p">[</span><span class="n">root</span><span class="err">@</span><span class="n">localhost</span> <span class="n">HERA</span><span class="p">]</span><span class="err">#</span> <span class="n">uname</span> <span class="o">-</span><span class="n">a</span>
<span class="n">Linux</span> <span class="n">localhost</span><span class="p">.</span><span class="n">localdomain</span> <span class="mi">4</span><span class="p">.</span><span class="mi">18</span><span class="p">.</span><span class="mi">0</span><span class="o">-</span><span class="mi">240</span><span class="p">.</span><span class="n">el8</span><span class="p">.</span><span class="n">x86_64</span> <span class="err">#</span><span class="mi">1</span> <span class="n">SMP</span> <span class="n">Fri</span> <span class="n">Sep</span> <span class="mi">25</span> <span class="mi">19</span><span class="o">:</span><span class="mi">48</span><span class="o">:</span><span class="mi">47</span> <span class="n">UTC</span> <span class="mi">2020</span> <span class="n">x86_64</span> <span class="n">x86_64</span> <span class="n">x86_64</span> <span class="n">GNU</span><span class="o">/</span><span class="n">Linux</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
</pre></td><td class="rouge-code"><pre><span class="p">[</span><span class="n">download</span><span class="o">-</span><span class="n">ib01</span><span class="p">.</span><span class="n">fedoraproject</span><span class="p">.</span><span class="n">org_pub_epel_8_Everything_x86_64_</span><span class="p">]</span>
<span class="n">name</span><span class="o">=</span><span class="n">created</span> <span class="n">by</span> <span class="n">dnf</span> <span class="n">config</span><span class="o">-</span><span class="n">manager</span> <span class="n">from</span> <span class="n">https</span><span class="o">:</span><span class="c1">//download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/</span>
<span class="n">baseurl</span><span class="o">=</span><span class="n">https</span><span class="o">:</span><span class="c1">//download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/</span>
<span class="n">enabled</span><span class="o">=</span><span class="mi">1</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">python36</span><span class="o">-</span><span class="n">colcon</span><span class="o">-</span><span class="n">core</span>
<span class="n">yum</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">colcon</span><span class="o">-</span><span class="n">common</span><span class="o">-</span><span class="n">extensions</span>
<span class="n">yum</span> <span class="n">install</span> <span class="n">cmake</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题1：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">HERA</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">iceoryx_v0</span><span class="p">.</span><span class="mi">17</span><span class="p">.</span><span class="mi">0</span><span class="o">/</span><span class="n">iceoryx_utils</span><span class="o">/</span><span class="n">platform</span><span class="o">/</span><span class="n">linux</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">iceoryx_utils</span><span class="o">/</span><span class="n">platform</span><span class="o">/</span><span class="n">acl</span><span class="p">.</span><span class="n">hpp</span><span class="o">:</span><span class="mi">17</span><span class="o">:</span><span class="mi">10</span><span class="o">:</span> <span class="n">fatal</span> <span class="n">error</span><span class="o">:</span> <span class="n">sys</span><span class="o">/</span><span class="n">acl</span><span class="p">.</span><span class="n">h</span><span class="o">:</span> <span class="n">No</span> <span class="n">such</span> <span class="n">file</span> <span class="n">or</span> <span class="n">directory</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">libacl</span><span class="o">-</span><span class="n">devel</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题2：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
</pre></td><td class="rouge-code"><pre><span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">)</span><span class="o">:</span>
  <span class="n">File</span> <span class="s">"/opt/hera/lib/python3.6/site-packages/ament_package/templates.py"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">19</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">import</span> <span class="n">importlib</span><span class="p">.</span><span class="n">resources</span> <span class="n">as</span> <span class="n">importlib_resources</span>
<span class="n">ModuleNotFoundError</span><span class="o">:</span> <span class="n">No</span> <span class="n">module</span> <span class="n">named</span> <span class="err">'</span><span class="n">importlib</span><span class="p">.</span><span class="n">resources</span><span class="err">'</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">importlib</span><span class="o">-</span><span class="n">resources</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题3:</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
</pre></td><td class="rouge-code"><pre><span class="n">Starting</span> <span class="o">&gt;&gt;&gt;</span> <span class="n">test_osrf_testing_tools_cpp</span>
<span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">iceoryx_posh</span>                                                                            
<span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">ld</span><span class="o">:</span> <span class="n">cannot</span> <span class="n">find</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">lib64</span><span class="o">/</span><span class="n">libatomic</span><span class="p">.</span><span class="n">so</span><span class="p">.</span><span class="mi">1</span><span class="p">.</span><span class="mi">2</span><span class="p">.</span><span class="mi">0</span>
<span class="n">collect2</span><span class="o">:</span> <span class="n">error</span><span class="o">:</span> <span class="n">ld</span> <span class="n">returned</span> <span class="mi">1</span> <span class="n">exit</span> <span class="n">status</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">libatomic</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题4：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
</pre></td><td class="rouge-code"><pre><span class="n">Starting</span> <span class="o">&gt;&gt;&gt;</span> <span class="n">ament_cmake_pyflakes</span>
<span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">tinyxml2_vendor</span>                                                                                       
<span class="n">CMake</span> <span class="n">Error</span> <span class="n">at</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">Modules</span><span class="o">/</span><span class="n">FindPackageHandleStandardArgs</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">165</span> <span class="p">(</span><span class="n">message</span><span class="p">)</span><span class="o">:</span>
  <span class="n">Could</span> <span class="n">NOT</span> <span class="n">find</span> <span class="n">TinyXML2</span> <span class="p">(</span><span class="n">missing</span><span class="o">:</span> <span class="n">TINYXML2_LIBRARY</span> <span class="n">TINYXML2_INCLUDE_DIR</span><span class="p">)</span>
<span class="n">Call</span> <span class="n">Stack</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">first</span><span class="p">)</span><span class="o">:</span>
  <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">Modules</span><span class="o">/</span><span class="n">FindPackageHandleStandardArgs</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">458</span> <span class="p">(</span><span class="n">_FPHSA_FAILURE_MESSAGE</span><span class="p">)</span>
  <span class="n">cmake</span><span class="o">/</span><span class="n">Modules</span><span class="o">/</span><span class="n">FindTinyXML2</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">58</span> <span class="p">(</span><span class="n">find_package_handle_standard_args</span><span class="p">)</span>
  <span class="n">CMakeLists</span><span class="p">.</span><span class="n">txt</span><span class="o">:</span><span class="mi">7</span> <span class="p">(</span><span class="n">find_package</span><span class="p">)</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">tinyxml2</span> <span class="n">tinyxml2</span><span class="o">-</span><span class="n">devel</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题5：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
</pre></td><td class="rouge-code"><pre><span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">rosidl_adapter</span>                                                           
<span class="n">CMake</span> <span class="n">Warning</span> <span class="n">at</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">hera</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">ament_cmake_pytest</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">ament_add_pytest_test</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">77</span> <span class="p">(</span><span class="n">message</span><span class="p">)</span><span class="o">:</span>
  <span class="n">The</span> <span class="n">Python</span> <span class="n">module</span> <span class="err">'</span><span class="n">pytest</span><span class="err">'</span> <span class="n">was</span> <span class="n">not</span> <span class="n">found</span><span class="p">,</span> <span class="n">pytests</span> <span class="n">cannot</span> <span class="n">be</span> <span class="n">run</span><span class="p">.</span>  <span class="n">On</span> <span class="n">Linux</span><span class="p">,</span>
  <span class="n">install</span> <span class="n">the</span> <span class="err">'</span><span class="n">python3</span><span class="o">-</span><span class="n">pytest</span><span class="err">'</span> <span class="n">package</span><span class="p">.</span>  <span class="n">On</span> <span class="n">other</span> <span class="n">platforms</span><span class="p">,</span> <span class="n">install</span> <span class="err">'</span><span class="n">pytest</span><span class="err">'</span>
  <span class="n">using</span> <span class="n">pip</span><span class="p">.</span>
<span class="n">Call</span> <span class="n">Stack</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">first</span><span class="p">)</span><span class="o">:</span>
  <span class="n">CMakeLists</span><span class="p">.</span><span class="n">txt</span><span class="o">:</span><span class="mi">14</span> <span class="p">(</span><span class="n">ament_add_pytest_test</span><span class="p">)</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题6：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="rouge-code"><pre><span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">rosidl_generator_c</span>                                                                              
<span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">)</span><span class="o">:</span>
  <span class="n">File</span> <span class="s">"/home/luocheng/HERA/src/ros2/rosidl/rosidl_generator_c/bin/rosidl_generator_c"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">8</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">from</span> <span class="n">rosidl_generator_c</span> <span class="n">import</span> <span class="n">generate_c</span>
<span class="n">ModuleNotFoundError</span><span class="o">:</span> <span class="n">No</span> <span class="n">module</span> <span class="n">named</span> <span class="err">'</span><span class="n">rosidl_generator_c</span><span class="err">'</span>

<span class="n">During</span> <span class="n">handling</span> <span class="n">of</span> <span class="n">the</span> <span class="n">above</span> <span class="n">exception</span><span class="p">,</span> <span class="n">another</span> <span class="n">exception</span> <span class="n">occurred</span><span class="o">:</span>

<span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">)</span><span class="o">:</span>
  <span class="n">File</span> <span class="s">"/home/luocheng/HERA/src/ros2/rosidl/rosidl_generator_c/bin/rosidl_generator_c"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">20</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">rosidl_generator_c</span> <span class="o">=</span> <span class="n">loader</span><span class="p">.</span><span class="n">load_module</span><span class="p">()</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap_external&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">399</span><span class="p">,</span> <span class="n">in</span> <span class="n">_check_name_wrapper</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap_external&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">823</span><span class="p">,</span> <span class="n">in</span> <span class="n">load_module</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap_external&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">682</span><span class="p">,</span> <span class="n">in</span> <span class="n">load_module</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">265</span><span class="p">,</span> <span class="n">in</span> <span class="n">_load_module_shim</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">684</span><span class="p">,</span> <span class="n">in</span> <span class="n">_load</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">665</span><span class="p">,</span> <span class="n">in</span> <span class="n">_load_unlocked</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap_external&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">678</span><span class="p">,</span> <span class="n">in</span> <span class="n">exec_module</span>
  <span class="n">File</span> <span class="s">"&lt;frozen importlib._bootstrap&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">219</span><span class="p">,</span> <span class="n">in</span> <span class="n">_call_with_frames_removed</span>
  <span class="n">File</span> <span class="s">"/home/luocheng/HERA/src/ros2/rosidl/rosidl_generator_c/rosidl_generator_c/__init__.py"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">15</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">from</span> <span class="n">rosidl_cmake</span> <span class="n">import</span> <span class="n">convert_camel_case_to_lower_case_underscore</span>
  <span class="n">File</span> <span class="s">"/opt/hera/lib/python3.6/site-packages/rosidl_cmake/__init__.py"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">24</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">from</span> <span class="n">rosidl_parser</span><span class="p">.</span><span class="n">parser</span> <span class="n">import</span> <span class="n">parse_idl_file</span>
  <span class="n">File</span> <span class="s">"/opt/hera/lib/python3.6/site-packages/rosidl_parser/parser.py"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">20</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
    <span class="n">from</span> <span class="n">lark</span> <span class="n">import</span> <span class="n">Lark</span>
<span class="n">ModuleNotFoundError</span><span class="o">:</span> <span class="n">No</span> <span class="n">module</span> <span class="n">named</span> <span class="err">'</span><span class="n">lark</span><span class="err">'</span>
<span class="n">gmake</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">:</span> <span class="o">***</span> <span class="p">[</span><span class="n">CMakeFiles</span><span class="o">/</span><span class="n">rosidl_generator_c_interfaces__rosidl_generator_c</span><span class="p">.</span><span class="n">dir</span><span class="o">/</span><span class="n">build</span><span class="p">.</span><span class="n">make</span><span class="o">:</span><span class="mi">104</span><span class="o">:</span> <span class="n">rosidl_generator_c</span><span class="o">/</span><span class="n">rosidl_generator_c</span><span class="o">/</span><span class="n">msg</span><span class="o">/</span><span class="n">arrays</span><span class="p">.</span><span class="n">h</span><span class="p">]</span> <span class="n">Error</span> <span class="mi">1</span>
<span class="n">gmake</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">:</span> <span class="o">***</span> <span class="p">[</span><span class="n">CMakeFiles</span><span class="o">/</span><span class="n">Makefile2</span><span class="o">:</span><span class="mi">298</span><span class="o">:</span> <span class="n">CMakeFiles</span><span class="o">/</span><span class="n">rosidl_generator_c_interfaces__rosidl_generator_c</span><span class="p">.</span><span class="n">dir</span><span class="o">/</span><span class="n">all</span><span class="p">]</span> <span class="n">Error</span> <span class="mi">2</span>
<span class="n">gmake</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">:</span> <span class="o">***</span> <span class="n">Waiting</span> <span class="k">for</span> <span class="n">unfinished</span> <span class="n">jobs</span><span class="p">....</span>
<span class="n">gmake</span><span class="o">:</span> <span class="o">***</span> <span class="p">[</span><span class="n">Makefile</span><span class="o">:</span><span class="mi">160</span><span class="o">:</span> <span class="n">all</span><span class="p">]</span> <span class="n">Error</span> <span class="mi">2</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">lark</span><span class="o">-</span><span class="n">parser</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题7：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
</pre></td><td class="rouge-code"><pre><span class="n">Starting</span> <span class="o">&gt;&gt;&gt;</span> <span class="n">test_launch_testing</span>
<span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">fastrtps</span>                                                                               
<span class="n">CMake</span> <span class="n">Error</span> <span class="n">at</span> <span class="n">cmake</span><span class="o">/</span><span class="n">modules</span><span class="o">/</span><span class="n">FindAsio</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">22</span> <span class="p">(</span><span class="n">message</span><span class="p">)</span><span class="o">:</span>
  <span class="n">Not</span> <span class="n">found</span> <span class="n">a</span> <span class="n">local</span> <span class="n">version</span> <span class="n">of</span> <span class="n">Asio</span> <span class="n">installed</span><span class="p">.</span>
<span class="n">Call</span> <span class="n">Stack</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">first</span><span class="p">)</span><span class="o">:</span>
  <span class="n">cmake</span><span class="o">/</span><span class="n">common</span><span class="o">/</span><span class="n">eprosima_libraries</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">212</span> <span class="p">(</span><span class="n">find_package</span><span class="p">)</span>
  <span class="n">CMakeLists</span><span class="p">.</span><span class="n">txt</span><span class="o">:</span><span class="mi">228</span> <span class="p">(</span><span class="n">eprosima_find_thirdparty</span><span class="p">)</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">boost</span>
<span class="c1">//https://pkgs.dyn.su/el8/extras/x86_64/asio-devel-1.14.0-12.el8.x86_64.rpm</span>
<span class="n">yum</span> <span class="n">localinstall</span> <span class="n">asio</span><span class="o">-</span><span class="n">devel</span><span class="o">-</span><span class="mi">1</span><span class="p">.</span><span class="mi">14</span><span class="p">.</span><span class="mi">0</span><span class="o">-</span><span class="mi">12</span><span class="p">.</span><span class="n">el8</span><span class="p">.</span><span class="n">x86_64</span><span class="p">.</span><span class="n">rpm</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题8：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="rouge-code"><pre><span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">rcl_logging_log4cxx</span>                                                                                
<span class="n">CMake</span> <span class="n">Error</span> <span class="n">at</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">Modules</span><span class="o">/</span><span class="n">FindPackageHandleStandardArgs</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">165</span> <span class="p">(</span><span class="n">message</span><span class="p">)</span><span class="o">:</span>
  <span class="n">Log4cxx_INCLUDE_DIR</span> <span class="p">(</span><span class="n">missing</span><span class="o">:</span> <span class="n">Log4cxx_LIBRARY</span><span class="p">)</span>
<span class="n">Call</span> <span class="n">Stack</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">first</span><span class="p">)</span><span class="o">:</span>
  <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">Modules</span><span class="o">/</span><span class="n">FindPackageHandleStandardArgs</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">458</span> <span class="p">(</span><span class="n">_FPHSA_FAILURE_MESSAGE</span><span class="p">)</span>
  <span class="n">cmake</span><span class="o">/</span><span class="n">FindLog4cxx</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">35</span> <span class="p">(</span><span class="n">FIND_PACKAGE_HANDLE_STANDARD_ARGS</span><span class="p">)</span>
  <span class="n">CMakeLists</span><span class="p">.</span><span class="n">txt</span><span class="o">:</span><span class="mi">16</span> <span class="p">(</span><span class="n">find_package</span><span class="p">)</span>


<span class="o">---</span>
<span class="n">Failed</span>   <span class="o">&lt;&lt;&lt;</span> <span class="n">rcl_logging_log4cxx</span> <span class="p">[</span><span class="mi">1</span><span class="p">.</span><span class="mo">04</span><span class="n">s</span><span class="p">,</span> <span class="n">exited</span> <span class="n">with</span> <span class="n">code</span> <span class="mi">1</span><span class="p">]</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">log4c</span> <span class="n">log4c</span><span class="o">-</span><span class="n">devel</span>  <span class="n">log4cplus</span> <span class="n">log4cplus</span><span class="o">-</span><span class="n">devel</span> <span class="n">log4cxx</span> <span class="n">log4cxx</span><span class="o">-</span><span class="n">devel</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>问题9：</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="rouge-code"><pre><span class="n">Starting</span> <span class="o">&gt;&gt;&gt;</span> <span class="n">rosidl_typesupport_cpp</span>
<span class="o">---</span> <span class="n">stderr</span><span class="o">:</span> <span class="n">rosidl_generator_py</span>                                                                                
<span class="n">Traceback</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">last</span><span class="p">)</span><span class="o">:</span>
  <span class="n">File</span> <span class="s">"&lt;string&gt;"</span><span class="p">,</span> <span class="n">line</span> <span class="mi">1</span><span class="p">,</span> <span class="n">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="n">ModuleNotFoundError</span><span class="o">:</span> <span class="n">No</span> <span class="n">module</span> <span class="n">named</span> <span class="err">'</span><span class="n">numpy</span><span class="err">'</span>
<span class="n">CMake</span> <span class="n">Error</span> <span class="n">at</span> <span class="n">cmake</span><span class="o">/</span><span class="n">rosidl_generator_py_generate_interfaces</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">213</span> <span class="p">(</span><span class="n">message</span><span class="p">)</span><span class="o">:</span>
  <span class="n">execute_process</span><span class="p">(</span><span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">python3</span> <span class="o">-</span><span class="n">c</span> <span class="err">'</span><span class="n">import</span>
  <span class="n">numpy</span><span class="p">;</span><span class="n">print</span><span class="p">(</span><span class="n">numpy</span><span class="p">.</span><span class="n">get_include</span><span class="p">())</span><span class="err">'</span><span class="p">)</span> <span class="n">returned</span> <span class="n">error</span> <span class="n">code</span> <span class="mi">1</span>
<span class="n">Call</span> <span class="n">Stack</span> <span class="p">(</span><span class="n">most</span> <span class="n">recent</span> <span class="n">call</span> <span class="n">first</span><span class="p">)</span><span class="o">:</span>
  <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">hera</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">ament_cmake_core</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">core</span><span class="o">/</span><span class="n">ament_execute_extensions</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">48</span> <span class="p">(</span><span class="n">include</span><span class="p">)</span>
  <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">hera</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">rosidl_cmake</span><span class="o">/</span><span class="n">cmake</span><span class="o">/</span><span class="n">rosidl_generate_interfaces</span><span class="p">.</span><span class="n">cmake</span><span class="o">:</span><span class="mi">286</span> <span class="p">(</span><span class="n">ament_execute_extensions</span><span class="p">)</span>
  <span class="n">CMakeLists</span><span class="p">.</span><span class="n">txt</span><span class="o">:</span><span class="mi">48</span> <span class="p">(</span><span class="n">rosidl_generate_interfaces</span><span class="p">)</span>


<span class="o">---</span>
<span class="n">Failed</span>   <span class="o">&lt;&lt;&lt;</span> <span class="n">rosidl_generator_py</span> <span class="p">[</span><span class="mi">1</span><span class="p">.</span><span class="mi">25</span><span class="n">s</span><span class="p">,</span> <span class="n">exited</span> <span class="n">with</span> <span class="n">code</span> <span class="mi">1</span><span class="p">]</span>
<span class="n">Aborted</span>  <span class="o">&lt;&lt;&lt;</span> <span class="n">rosidl_typesupport_cpp</span> <span class="p">[</span><span class="mi">4</span><span class="p">.</span><span class="mi">56</span><span class="n">s</span><span class="p">]</span>  
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">yum</span> <span class="n">install</span> <span class="n">python3</span><span class="o">-</span><span class="n">numpy</span>
</pre></td></tr></tbody></table></code></div></div>

<h4 id="2-用例测试"><span class="me-2">2&gt; 用例测试</span><a href="#2-用例测试" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h4>

<p><strong>1.hera编完要这样设置下环境变量，再去编测试套。</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="n">source</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">hera</span><span class="o">/</span><span class="n">setup</span><span class="p">.</span><span class="n">bash</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>2.clone测试套和编译</strong></p>

<pre><code class="language-C">git clone ssh://git@szv-y.codehub.huawei.com:2222/D_Lab/AscendRobotics/RobotSDK_Tests.git
cd RobotSDK_Tests/ROS2/dev_ws

#Step1：编译自定义的数据结构
colcon build --packages-select my_struct

#Step2：执行环境变量脚本
source install/setup.bash

#Step3：编译listen_talk包
colcon build --packages-select listen_talk

</code></pre>

<p><strong>3.运行</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="rouge-code"><pre><span class="n">cd</span> <span class="n">build</span><span class="o">/</span><span class="n">listen_talk</span><span class="o">/</span>
<span class="cp">#pty1
</span><span class="p">.</span><span class="o">/</span><span class="n">talker</span> <span class="p">[</span> <span class="o">-</span><span class="n">z</span> <span class="p">]</span>  <span class="err">##</span> <span class="o">-</span><span class="n">z</span> <span class="err">为</span><span class="n">zero</span><span class="o">-</span><span class="n">copy</span><span class="err">版本</span>
    
 <span class="cp">#pty2
</span> <span class="p">.</span><span class="o">/</span><span class="n">listener</span>
</pre></td></tr></tbody></table></code></div></div>

<p><strong>4.result</strong></p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
</pre></td><td class="rouge-code"><pre><span class="cp">#pty1
</span><span class="p">[</span><span class="n">root</span><span class="err">@</span><span class="n">localhost</span> <span class="n">listen_talk</span><span class="p">]</span><span class="err">#</span> <span class="p">.</span><span class="o">/</span><span class="n">talker</span> <span class="o">-</span><span class="n">z</span>
<span class="n">Starting</span> <span class="n">to</span> <span class="k">do</span> <span class="n">test</span> <span class="n">using</span> <span class="n">zero</span><span class="o">-</span><span class="n">copy</span><span class="o">!!!!!!!!!!!!!</span>
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937655</span><span class="p">.</span><span class="mi">203340827</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_publisher</span><span class="p">]</span><span class="o">:</span> <span class="n">Publishing</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span> <span class="mi">64</span> <span class="mi">0</span><span class="p">)</span> <span class="mi">1623937655203335</span>
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937656</span><span class="p">.</span><span class="mi">203293168</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_publisher</span><span class="p">]</span><span class="o">:</span> <span class="n">Publishing</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span> <span class="mi">64</span> <span class="mi">1</span><span class="p">)</span> <span class="mi">1623937656203291</span>
</pre></td></tr></tbody></table></code></div></div>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="rouge-code"><pre><span class="cp">#pty2
</span><span class="p">[</span><span class="n">root</span><span class="err">@</span><span class="n">localhost</span> <span class="n">listen_talk</span><span class="p">]</span><span class="err">#</span> <span class="p">.</span><span class="o">/</span><span class="n">listener</span> 
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937688</span><span class="p">.</span><span class="mi">203468974</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_subscriber</span><span class="p">]</span><span class="o">:</span> <span class="n">I</span> <span class="n">heard</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">64</span><span class="p">,</span> <span class="mi">33</span><span class="p">),</span> <span class="n">size</span> <span class="o">=</span> <span class="mi">2097152</span><span class="p">,</span> <span class="n">latency</span><span class="o">:</span> <span class="mi">157</span> <span class="n">us</span>
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937689</span><span class="p">.</span><span class="mi">203369801</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_subscriber</span><span class="p">]</span><span class="o">:</span> <span class="n">I</span> <span class="n">heard</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">64</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> <span class="n">size</span> <span class="o">=</span> <span class="mi">2097152</span><span class="p">,</span> <span class="n">latency</span><span class="o">:</span> <span class="mi">78</span> <span class="n">us</span>
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937690</span><span class="p">.</span><span class="mi">203362141</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_subscriber</span><span class="p">]</span><span class="o">:</span> <span class="n">I</span> <span class="n">heard</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">64</span><span class="p">,</span> <span class="mi">35</span><span class="p">),</span> <span class="n">size</span> <span class="o">=</span> <span class="mi">2097152</span><span class="p">,</span> <span class="n">latency</span><span class="o">:</span> <span class="mi">73</span> <span class="n">us</span>
<span class="p">[</span><span class="n">INFO</span><span class="p">]</span> <span class="p">[</span><span class="mi">1623937691</span><span class="p">.</span><span class="mi">203375374</span><span class="p">]</span> <span class="p">[</span><span class="n">minimal_subscriber</span><span class="p">]</span><span class="o">:</span> <span class="n">I</span> <span class="n">heard</span><span class="o">:</span> <span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">64</span><span class="p">,</span> <span class="mi">36</span><span class="p">),</span> <span class="n">size</span> <span class="o">=</span> <span class="mi">2097152</span><span class="p">,</span> <span class="n">latency</span><span class="o">:</span> <span class="mi">80</span> <span class="n">us</span>
</pre></td></tr></tbody></table></code></div></div>

<h3 id="四-ros2场景-工业机械臂"><span class="me-2">四 ROS2场景-工业机械臂</span><a href="#四-ros2场景-工业机械臂" class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//cn.element14.com/robotic-arm</span>
</pre></td></tr></tbody></table></code></div></div>

<p>​	机械臂是工业机器人的一个关键组成部分。通过机械臂上安装的工具，可以执行各种不同的工作，如焊接、油漆和货盘装运。目前在广泛的工业应用中采用了若干类型的机械臂，即卡式机械臂、圆柱机械臂、极性机械臂和关节式机械臂。其中关节式机械臂使用最广，并且其DOF（自由度）较高，体积小，操作范围广，可以避开小范围内的障碍物。</p>

<p>​	关节式机械臂通常由刚性杆和可旋转关节构成。伺服控制系统用于控制伺服电机，后者驱动关节旋转。该系统中包含三个模块：伺服电机控制模块、传感器模块和中央控制模块。伺服电机控制模块中集成了MCU、电机驱动器、编码器与电流传感器。MCU根据中央模块的指令MCU将控制信号发给电机驱动器，后者放大这些信号以驱动电机旋转。编码器和电流传感器负责监测电机，并将反馈信息发送回MCU，以确保伺服电机正常工作。传感器模块涉及多种类型的传感器，如接近传感器、图像传感器、压力传感器和LVDT传感器，这些传感器用于收集有关机械臂的运动信息，并在由信号调节电路处理之后发送给中央控制模块。中央控制模块拥有DSP和PLC模块。DSP根据传感器模块提供的数据计算关节的运动轨迹和参数。然后通过CAN总线将结果发送给伺服电机控制模块，以便机械臂实施所需操作。PLC模块提供人机界面，供用户设置程序来控制机械臂。此外，PLC模块还有用于连接紧急按钮和不同类型继电器的接口，紧急按钮和继电器用于控制机械臂上连接的工具。</p>

<div class="language-c highlighter-rouge"><div class="code-header">
        <span data-label-text="C"><i class="fas fa-code fa-fw small"></i></span>
      <button aria-label="copy" data-title-succeed="Copied!"><i class="far fa-clipboard"></i></button></div><div class="highlight"><code><table class="rouge-table"><tbody><tr><td class="rouge-gutter gl"><pre class="lineno">1
</pre></td><td class="rouge-code"><pre><span class="nl">https:</span><span class="c1">//wenku.baidu.com/view/9e3e54d86f1aff00bed51e2a.html</span>
</pre></td></tr></tbody></table></code></div></div>

</div>

<div class="post-tail-wrapper text-muted">

  <!-- categories -->
  
  <div class="post-meta mb-3">
    <i class="far fa-folder-open fa-fw me-1"></i>
    
      <a href='/categories/package/'>Package</a>,
      <a href='/categories/ros2/'>ROS2</a>
  </div>
  
  <!-- post.html -->

  <!-- tags -->
  
  <div class="post-tags">
    <i class="fa fa-tags fa-fw me-1"></i>
      
      <a href="/tags/ros2/"
          class="post-tag no-text-decoration" >ROS2</a>
      
  </div>
  
  
  <div class="post-tail-bottom
    d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
    <div class="license-wrapper">

      

        

        This post is licensed under 
        <a href="https://creativecommons.org/licenses/by/4.0/">
          CC BY 4.0
        </a>
         by the author.

      
    </div>

    <!-- Post sharing snippet -->

<div class="share-wrapper">
  <span class="share-label text-muted me-1">Share</span>
  <span class="share-icons">
    
    
    

    
      
      <a
        href="https://twitter.com/intent/tweet?text=The%20Robot%20Operating%20System%202%20(ROS2)%20-%20Cheng%20Luo&url=https%3A%2F%2Fluochenglcs.github.io%2Fposts%2FROS2-For-Industrial-Control%2F"
        data-bs-toggle="tooltip"
        data-bs-placement="top"
        title="Twitter"
        target="_blank"
        rel="noopener"
        aria-label="Twitter"
      >
        <i class="fa-fw fab fa-twitter"></i>
      </a>
    
      
      <a
        href="https://www.facebook.com/sharer/sharer.php?title=The%20Robot%20Operating%20System%202%20(ROS2)%20-%20Cheng%20Luo&u=https%3A%2F%2Fluochenglcs.github.io%2Fposts%2FROS2-For-Industrial-Control%2F"
        data-bs-toggle="tooltip"
        data-bs-placement="top"
        title="Facebook"
        target="_blank"
        rel="noopener"
        aria-label="Facebook"
      >
        <i class="fa-fw fab fa-facebook-square"></i>
      </a>
    
      
      <a
        href="https://t.me/share/url?url=https%3A%2F%2Fluochenglcs.github.io%2Fposts%2FROS2-For-Industrial-Control%2F&text=The%20Robot%20Operating%20System%202%20(ROS2)%20-%20Cheng%20Luo"
        data-bs-toggle="tooltip"
        data-bs-placement="top"
        title="Telegram"
        target="_blank"
        rel="noopener"
        aria-label="Telegram"
      >
        <i class="fa-fw fab fa-telegram"></i>
      </a>
    

    <i
      id="copy-link"
      class="fa-fw fas fa-link small"
      data-bs-toggle="tooltip"
      data-bs-placement="top"
      title="Copy link"
      data-title-succeed="Link copied successfully!"
    >
    </i>
  </span>
</div>


  </div><!-- .post-tail-bottom -->

</div><!-- div.post-tail-wrapper -->


      
    
      
    </div>
  </div>
  <!-- #core-wrapper -->

  <!-- panel -->
  <div id="panel-wrapper" class="col-xl-3 ps-2 text-muted">
    <div class="access">
      <!-- Get the last 5 posts from lastmod list. -->














  <div id="access-lastmod" class="post">
    <div class="panel-heading">Recently Updated</div>
    <ul class="post-content list-unstyled ps-0 pb-1 ms-1 mt-2">
      
        
        
        
        <li class="text-truncate lh-lg">
          <a href="/posts/%E5%86%85%E5%AD%98%E6%95%B0%E6%8D%AE%E5%BA%93/">MMDB (memory database)</a>
        </li>
      
        
        
        
        <li class="text-truncate lh-lg">
          <a href="/posts/userspace-rcu%E9%94%81/">userspace rcu lock</a>
        </li>
      
        
        
        
        <li class="text-truncate lh-lg">
          <a href="/posts/Real-time-operating-system/">Realtime Operating System</a>
        </li>
      
        
        
        
        <li class="text-truncate lh-lg">
          <a href="/posts/HUNDSUN-LightOS/">Hundsun Lightos</a>
        </li>
      
        
        
        
        <li class="text-truncate lh-lg">
          <a href="/posts/linux-struct-folio/">struct folio</a>
        </li>
      
    </ul>
  </div>
  <!-- #access-lastmod -->


      <!-- The trending tags list -->















  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        



  <div id="access-tags">
    <div class="panel-heading">Trending Tags</div>
    <div class="d-flex flex-wrap mt-3 mb-1 me-3">
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/lock/">lock</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/libumem/">libumem</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/mm/">mm</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/autonuma/">autonuma</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/bfs/">BFS</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/bus/">Bus</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/caladan/">caladan</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/damon/">damon</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/deep-learning/">Deep Learning</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/dma/">DMA</a>
      
    </div>
  </div>


    </div>

    
      
      



  <div id="toc-wrapper" class="ps-0 pe-4 mb-5">
    <div class="panel-heading ps-3 pt-2 mb-2">Contents</div>
    <nav id="toc"><ul><li>The Robot Operating System 2 (ROS2)<ul><li><a href="#一ros2介绍">一、ROS2介绍</a><ul><li><a href="#1-基本概念ros1-vs-ros2png">1) 基本概念ROS1 Vs ROS2.png</a></li><li><a href="#2-qos">2) Qos</a></li><li><a href="#3real-time-publishsubscribe-protocol">3)Real-Time Publish/Subscribe Protocol</a></li></ul></li><li><a href="#二dds介绍">二、DDS介绍</a></li><li><a href="#三使用">三、使用</a><ul><li><a href="#1-编译">1&gt; 编译</a></li><li><a href="#2-用例测试">2&gt; 用例测试</a></li></ul></li><li><a href="#四-ros2场景-工业机械臂">四 ROS2场景-工业机械臂</a></li></ul></li></ul></li></ul></nav>
  </div>
  


    
  </div>
</div>

<!-- tail -->

  <div class="row">
    <div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 px-3 pe-xl-4 mt-5">
      
        
        <!--
  Recommend the other 3 posts according to the tags and categories of the current post,
  if the number is not enough, use the other latest posts to supplement.
-->

<!-- The total size of related posts -->


<!-- An random integer that bigger than 0 -->


<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->








  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  
    
  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  






<!-- Fill with the other newlest posts -->





  <div id="related-posts" class="mb-2 mb-sm-4">
    <h3 class="pt-2 mb-4 ms-1" data-toc-skip>
      Further Reading
    </h3>
    <div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">
      
        
        
        <div class="col">
          <a href="/posts/numad-start-failed/" class="card post-preview h-100">
            <div class="card-body">
              <!--
  Date format snippet
  See: ${JS_ROOT}/utils/locale-dateime.js
-->





<em
  class="small"
  data-ts="1600323000"
  data-df="ll"
  
>
  Sep 17, 2020
</em>

              <h4 class="pt-0 my-2" data-toc-skip>numad systemctl start failed</h4>
              <div class="text-muted small">
                <p>
                  





                  1 systemct start failed
1、R9 x86环境systemctl启动失败

● numad.service - numad - The NUMA daemon that manages application locality.
   Loaded: loaded (/usr/lib/systemd/system/numad.service; disabled; ven...
                </p>
              </div>
            </div>
          </a>
        </div>
      
        
        
        <div class="col">
          <a href="/posts/sunos-mdb/" class="card post-preview h-100">
            <div class="card-body">
              <!--
  Date format snippet
  See: ${JS_ROOT}/utils/locale-dateime.js
-->





<em
  class="small"
  data-ts="1603152000"
  data-df="ll"
  
>
  Oct 20, 2020
</em>

              <h4 class="pt-0 my-2" data-toc-skip>Modular Debugger (MDB)</h4>
              <div class="text-muted small">
                <p>
                  





                  适用于linux系统的mdb：
https://github.com/luochenglcs/mdb

If the code is useful to you - great !. Spread it around and get people to use, debug and enhance it.

一、libumem_ready赋值

umem_update_variables
 ...
                </p>
              </div>
            </div>
          </a>
        </div>
      
        
        
        <div class="col">
          <a href="/posts/sunos-libumem/" class="card post-preview h-100">
            <div class="card-body">
              <!--
  Date format snippet
  See: ${JS_ROOT}/utils/locale-dateime.js
-->





<em
  class="small"
  data-ts="1612310400"
  data-df="ll"
  
>
  Feb  3, 2021
</em>

              <h4 class="pt-0 my-2" data-toc-skip>user space slab memory allocator - libumem</h4>
              <div class="text-muted small">
                <p>
                  





                  对应github：
https://github.com/luochenglcs/libumem

reference:
https://arrowpig1979.wordpress.com/2008/08/16/%e4%bd%bf%e7%94%a8libumem%e5%ae%9a%e4%bd%8dmemory-leak%e5%92%8cmemory-corruption%ef%bc%884...
                </p>
              </div>
            </div>
          </a>
        </div>
      
    </div>
    <!-- .card-deck -->
  </div>
  <!-- #related-posts -->


      
        
        <!-- Navigation buttons at the bottom of the post. -->

<div class="post-navigation d-flex justify-content-between">
  
    <a
      href="/posts/Real-time-operating-system/"
      class="btn btn-outline-primary"
      prompt="Older"
    >
      <p>Realtime Operating System</p>
    </a>
  

  
    <a
      href="/posts/Customized-Scheduler-In-Userspace/"
      class="btn btn-outline-primary"
      prompt="Newer"
    >
      <p>Customized Scheduler - google Ghost</p>
    </a>
  
</div>

      
        
        <!--  The comments switcher -->


      
    </div>
  </div>


        <!-- The Search results -->

<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
  <div class="col-11 post-content">
    <div id="search-hints">
      <!-- The trending tags list -->















  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        

  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
    
  
    
    
    
    
      
        
        



  <div id="access-tags">
    <div class="panel-heading">Trending Tags</div>
    <div class="d-flex flex-wrap mt-3 mb-1 me-3">
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/lock/">lock</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/libumem/">libumem</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/mm/">mm</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/autonuma/">autonuma</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/bfs/">BFS</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/bus/">Bus</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/caladan/">caladan</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/damon/">damon</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/deep-learning/">Deep Learning</a>
      
        
        <a class="post-tag btn btn-outline-primary" href="/tags/dma/">DMA</a>
      
    </div>
  </div>


    </div>
    <div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
  </div>
</div>

      </div>
    </div>

    <!-- The Footer -->

<footer>
  <div class="container px-lg-4">
    <div class="d-flex justify-content-center align-items-center text-muted mx-md-3">
      <p>Using the <a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a> theme <a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
      </p>

      <p>©
        2023
        <a href="https://gitee.com/luochenglcs">luochunsheng</a>.
        
          <span
            data-bs-toggle="tooltip"
            data-bs-placement="top"
            title="Except where otherwise noted, the blog posts on this site are licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author."
          >Some rights reserved.</span>
        
      </p>
    </div>
  </div>
</footer>


    <div id="mask"></div>

    <button id="back-to-top" aria-label="back-to-top" class="btn btn-lg btn-box-shadow">
      <i class="fas fa-angle-up"></i>
    </button>

    
      <div
        id="notification"
        class="toast"
        role="alert"
        aria-live="assertive"
        aria-atomic="true"
        data-bs-animation="true"
        data-bs-autohide="false"
      >
        <div class="toast-header">
          <button
            type="button"
            class="btn-close ms-auto"
            data-bs-dismiss="toast"
            aria-label="Close"
          ></button>
        </div>
        <div class="toast-body text-center pt-0">
          <p class="px-2 mb-3">A new version of content is available.</p>
          <button type="button" class="btn btn-primary" aria-label="Update">
            Update
          </button>
        </div>
      </div>
    

    <!-- JS selector for site. -->

<!-- commons -->



<!-- layout specified -->


  

  
    <!-- image lazy-loading & popup & clipboard -->
    
  















  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  

  
    

    

  



  <script src="https://cdn.jsdelivr.net/combine/npm/jquery@3.7.0/dist/jquery.min.js,npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js,npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js,npm/lazysizes@5.3.2/lazysizes.min.js,npm/magnific-popup@1.1.0/dist/jquery.magnific-popup.min.js,npm/clipboard@2.0.11/dist/clipboard.min.js,npm/dayjs@1.11.7/dayjs.min.js,npm/dayjs@1.11.7/locale/en.min.js,npm/dayjs@1.11.7/plugin/relativeTime.min.js,npm/dayjs@1.11.7/plugin/localizedFormat.min.js,npm/tocbot@4.21.0/dist/tocbot.min.js"></script>






<script defer src="/assets/js/dist/post.min.js"></script>






    

    <!--
  Jekyll Simple Search loader
  See: <https://github.com/christian-fei/Simple-Jekyll-Search>
-->





<script>
  /* Note: dependent library will be loaded in `js-selector.html` */
  SimpleJekyllSearch({
    searchInput: document.getElementById('search-input'),
    resultsContainer: document.getElementById('search-results'),
    json: '/assets/js/data/search.json',
    searchResultTemplate: '<div class="px-1 px-sm-2 px-lg-4 px-xl-0">  <a href="{url}">{title}</a>  <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">    {categories}    {tags}  </div>  <p>{snippet}</p></div>',
    noResultsText: '<p class="mt-5"></p>',
    templateMiddleware: function(prop, value, template) {
      if (prop === 'categories') {
        if (value === '') {
          return `${value}`;
        } else {
          return `<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
        }
      }

      if (prop === 'tags') {
        if (value === '') {
          return `${value}`;
        } else {
          return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
        }
      }
    }
  });
</script>

  </body>
</html>

